<template>
    <div class="app-container1 show-back-class">
      <div style="width: 100%;height: 60px;border-bottom: #1C97FF 1px solid;padding:  10px 20px;display: flex;">
        <img style="width: 340px; height: 40px; margin-right: 20px;" src="@/assets/bigScreen/index/LOGO.jpg" alt="">
        <big-tab-Bar />
      </div>
      <div class="content-bottom">
        <!-- <el-form :model="queryParams" ref="queryForm" :inline="true" v-show="showSearch" label-width="68px">
          <el-form-item label="购买方" prop="glStationId">
            <el-select v-model="queryParams.glStationId" placeholder="请选择购买方" style="width: 100%"  >
              <el-option class="index-option" v-for="dict in  stationInfoList" :key="dict.stationId" v-if="dict.status===1"
                         :label="dict.stationName" :value="parseInt(dict.stationId)" />
            </el-select>
          </el-form-item>
          <el-form-item>
            <el-button type="cyan" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
            <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
          </el-form-item>
        </el-form> -->
  
        <!-- <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAdd" v-hasPermi="['greenCertificate:certificate:add']">新增</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="success" icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate" v-hasPermi="['greenCertificate:certificate:edit']">修改</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete" v-hasPermi="['greenCertificate:certificate:remove']">删除</el-button>
          </el-col>
        </el-row> -->
  
        <el-table v-loading="loading" :height="tableHeight" :data="certificateList" @selection-change="handleSelectionChange" border>
          <el-table-column width="55" type="index" label="序号" align="center"/>
          <el-table-column label="购买名称" align="center" prop="purchaserName" />
          <el-table-column label="需求个数(个)" align="center" prop="demandNum" />
          <el-table-column label="单价(元)" align="center" prop="unitPrice" />
          <el-table-column label="发布时间" align="center" prop="releaseTime" width="180" />
        </el-table>
  
        <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList"/>
      </div>
    </div>
  </template>
  
  <script>
  import { listPurchaser } from "@/api/carbon/greenCertificate";
  import bigTabBar from '@/views/components/bigTabBar/index'
  export default {
    name: "certificate",
    components:{
      bigTabBar
    },
    data() {
      return {
        // 遮罩层
        loading: true,
        stationInfoList: [],
        // 选中数组
        ids: [],
        // 非单个禁用
        single: true,
        // 非多个禁用
        multiple: true,
        // 显示搜索条件
        showSearch: true,
        // 总条数
        total: 0,
        // 绿证管理表格数据
        certificateList: [],
        // 弹出层标题
        title: "",
        // 是否显示弹出层
        open: false,
        // 查询参数
        queryParams: {
          pageNum: 1,
          pageSize: 10,
        },
        // 表单参数
        form: {},
        // 表单校验
        rules: {
        },
        tableHeight: '',
      };
    },
    created() {
      this.tableHeight = window.innerHeight - 200;
      this.getList();
    },
    methods: {
      /** 查询绿证管理列表 */
      getList() {
        this.loading = true;
        listPurchaser(this.queryParams).then(response => {
          this.certificateList = response.rows;
          this.total = response.total;
          this.loading = false;
        });
      },
      // 取消按钮
      cancel() {
        this.open = false;
        this.reset();
      },
      /** 搜索按钮操作 */
      handleQuery() {
        this.queryParams.pageNum = 1;
        this.getList();
      },
      /** 导出按钮操作 */
      handleExport() {
        const queryParams = this.queryParams;
        this.$confirm('是否确认导出所有绿证管理数据项?', "警告", {
            confirmButtonText: "确定",
            cancelButtonText: "取消",
            type: "warning"
          }).then(function() {
            return exportCertificate(queryParams);
          }).then(response => {
            this.download(response.msg);
          }).catch(function() {});
      }
    }
  };
  </script>
  <style lang="scss" scoped>
  .app-container1{
    position: relative;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background-color: #000D17;
    // background: url("../../assets/bg2.jpg") no-repeat;
    // background-size: 100% 100%;
  }
  .content-bottom{
    width: 100%;
    height: calc(100% - 60px);
    background-color: #000D17;
    padding: 20px;
  }
  .pagination-container {
    height: 50px;
  }
  </style>